import { createApp } from "vue";
import App from "./App.vue";
import "./assets/tailwind.css"; // 引入 Tailwind CSS
import "./index.scss";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css"; // 引入 Element Plus 样式
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import zhCn from "element-plus/es/locale/lang/zh-cn";
// 引入字体文件
import "@/assets/static/font/iconfont.css";
// SVG插件配置
import "virtual:svg-icons-register";
import gloabComponent from "./components/index"; // 注册全局组件
import dayjs from "dayjs";
import "dayjs/locale/zh-cn";
// 引入echarts
import * as echarts from "echarts";
// echarts主题
import chalk from "@/assets/static/theme/chalk.js";
import vintage from "@/assets/static/theme/vintage.js";
import SocketService from "@/utils/socket_service.js";
// 注册主题
echarts.registerTheme("chalk", chalk);
// 注册主题
echarts.registerTheme("vintage", vintage);
// 引入pinia
import pinia from './store'
import router from "@/router";


const app = createApp(App);
const socketService = SocketService.Instance; // 先获取实例
socketService.connect(); // 再调用连接方法
// 注册socket服务 --挂载到全局属性SocketService
app.config.globalProperties.$socket = socketService;

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.use(ElementPlus, {
  locale: zhCn
});
dayjs.locale("zh-cn");
// 挂载到全局属性
app.config.globalProperties.$echarts = echarts;
// 注册路由
app.use(router);
app.use(pinia)
// 注册全局通用组件
app.use(gloabComponent);
app.mount("#app");
